<template>
  <div>
    <div v-show='show' class="wrap" v-for='(item,index) in lists'>
      <!--<div  class="icon">
        {{item.code | codeTo2}}
      </div>-->
      <div class="details" @click='toBuy(item.stockCode)'>
        <div class="user">
          <span>{{item.stockName}}</span>
          <br>
          <span class="tips">{{item.stockCode }}</span>
        </div>
        <div class="products">
          <span>{{item.stockNum}}股</span>
        </div>
        <div class="profit" >
         			跟买
        </div>
      </div>
     
    </div>
     <p style="color: white; text-align: center;  height: 4.72rem; line-height: 4.72rem;" v-show="lists.length==0&&show">暂无数据</p>
  	
  </div>
</template>
<script>
	import home from '@/api/home/index'
	import { toast,isRealName,isBankNumber } from '@/util/index'
export default {
  data(){
    return {
      lists:"",
    }
  },
  props: {
    show: {
      type: Boolean,
      default: true
    }
  },
  methods:{
    toBuy(num){
     this.$router.push({
	            path: '/tAdd1/', 
	            name: 'tAdd1',
	            query: { 
	                "stockNum": num
	            }
	           
	        })
    }
  },
   mounted(){
  		let senddata = {
  			plat:"mlj"
			}
				home.ideaRank(senddata).then((data) => {
					if (data.data.code == 200) {
						//console.log(data.data.data)
						this.lists=data.data.data
						
					} else {
						toast(data.data.message)
					}
				})
				
  },
  filters:{
    codeTo2(value){
      return value.substring(0,2)
    },
    codeTo3(value){
      return value.substring(0,10)
    }
  }
}
</script>

<style lang="less" scoped>
@import '../../less/config.less';
.wrap {
  height: 1.6rem;
  color: @fcolor;
  font-size: 0.37333rem;
  padding: 0 @p30;
  border-bottom: 1px solid #1f232e;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .icon{
    width: 0.37333rem;
    height:  0.37333rem;
    line-height: 1.6;
    background-color:#ff335b;
    border-radius:4px;
    font-size: 0.24rem;
    text-align: center
  }
  img {
    width: 0.64rem;
    height: 0.73333rem;
  }
  .details {
    position: relative;
    height: 1.6rem;
    width: 8.42267rem;
    margin-left: 0.26667rem;
    div {
      position: absolute;
      line-height: 1.5;
    }
    .user {
      top: 0.3rem;
      left: 0;
    }
    .products {
      top: 0.4rem;
      left: 3rem;
      text-align: center;
    }
    .profit {
      top: 0.45rem;
      right: -1rem;
      color: @actColor;
      width: 3.2rem;
      height: 0.506*2rem;
      text-align: center;
      background: #ff335b;
      color: white;
      border-radius:0.506rem;
      font-size: @fsize*2;
      transform: scale(0.5);
    	transform-origin: 0% 0%;
      line-height: 0.506*2rem;
      display: table-cell;
	    text-align: center;
	    vertical-align: middle;
    }
    .tips {
      color: @Color;
      font-size: 0.32rem;
    }
  }
}
</style>
